// ======================================================================
// Copyright (C) 2013 Hell-Prototypes. / www.hellprototypes.com
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or (at
// your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// ======================================================================
#ifndef PLOT_WAVE_FORM_H
#define PLOT_WAVE_FORM_H
#include <qwt_plot.h>
#include <qwt_system_clock.h>
#include "plot_raw_data.h"
#include "plot_grid.h"
#include "define.h"

class QwtPlotGrid;
class QwtPlotCurve;
class QwtSeriesData<double>;

class plot_wave_form : public QwtPlot
{
    Q_OBJECT
public:
    explicit plot_wave_form( QWidget* = NULL );

    bool new_data_arise(t_circular_buffer *cb);
    bool set_x_axis_sample_number(int x_axis_sample_number);
    void start_plot();
    void stop_plot();

protected:
    virtual void timerEvent( QTimerEvent *e );
    virtual void resizeEvent(QResizeEvent * event);

private:
    plot_grid *m_grid;
    QwtPlotCurve *m_curve;

    plot_raw_data *m_plot_raw_data;
    QVector<double> m_raw_data_cache;

    QwtSystemClock m_sys_clock;
    int m_timer_id;
    int m_x_axis_sample_number;
    int m_x_axis_scale;

signals:
    
public slots:
    
};

#endif // PLOT_WAVE_FORM_H
